home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / libg++ / configure < prev    next >
Text File  |  1994-02-15  |  41KB  |  1,020 lines

  1. #!/bin/sh
  2.  
  3. ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
  4.  
  5. # Configuration script
  6. #   Copyright (C) 1988, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  7.  
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. # Please email any bugs, comments, and/or additions to this file to:
  21. # configure@cygnus.com
  22.  
  23. # This file was written by K. Richard Pixley.
  24.  
  25. #
  26. # Shell script to create proper links to machine-dependent files in
  27. # preparation for compilation.
  28. #
  29. # If configure succeeds, it leaves its status in config.status.
  30. # If configure fails after disturbing the status quo, 
  31. #       config.status is removed.
  32. #
  33.  
  34. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  35.  
  36. remove=rm
  37. hard_link=ln
  38. symbolic_link='ln -s'
  39.  
  40. #for Test
  41. #remove="echo rm"
  42. #hard_link="echo ln"
  43. #symbolic_link="echo ln -s"
  44.  
  45. # clear some things potentially inherited from environment.
  46.  
  47. Makefile=Makefile
  48. Makefile_in=Makefile.in
  49. arguments=$*
  50. build_alias=
  51. configdirs=
  52. exec_prefix=
  53. exec_prefixoption=
  54. fatal=
  55. floating_point=default
  56. gas=default
  57. host_alias=
  58. host_makefile_frag=
  59. moveifchange=
  60. next_build=
  61. next_host=
  62. next_prefix=
  63. next_site=
  64. next_srcdir=
  65. next_target=
  66. next_tmpdir=
  67. norecursion=
  68. package_makefile_frag=
  69. #prefix=/usr/local
  70. prefix=/usr
  71. progname=
  72. program_prefix=
  73. program_prefixoption=
  74. program_suffix=
  75. program_suffixoption=
  76. program_transform_name=
  77. program_transform_nameoption=
  78. redirect=">/dev/null"
  79. removing=
  80. site=
  81. site_makefile_frag=
  82. site_option=
  83. srcdir=
  84. srctrigger=
  85. subdirs=
  86. target_alias=
  87. target_makefile_frag=
  88. undefinedargs=
  89. version="$Revision: 1.172 $"
  90. x11=default
  91.  
  92. ### we might need to use some other shell than /bin/sh for running subshells
  93. #
  94. config_shell=${CONFIG_SHELL-/bin/sh}
  95.  
  96. NO_EDIT="This file was generated automatically by configure.  Do not edit."
  97.  
  98. ## this is a little touchy and won't always work, but...
  99. ##
  100. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  101. ## must) be used as is.
  102. ##
  103. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  104. ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  105. ##
  106.  
  107. progname=$0
  108. # if PWD already has a value, it is probably wrong.
  109. if [ -n "$PWD" ]; then PWD=`pwd`; fi
  110.  
  111. case "${progname}" in
  112. /*) ;;
  113. */*) ;;
  114. *)
  115.         PATH=$PATH:${PWD=`pwd`} ; export PATH
  116.         ;;
  117. esac
  118.  
  119. for arg in $*
  120. do
  121.         # handle things that might have args following as separate words
  122.         if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
  123.         elif [ -n "${next_exec_prefix}" ] ; then
  124.                 exec_prefix=${arg}
  125.                 exec_prefixoption="-exec-prefix=${exec_prefix}"
  126.                 next_exec_prefix=
  127.         elif [ -n "${next_site}" ] ; then site=${arg} ; site_option=-site=${site} ; next_site=
  128.         # remove any possible trailing slash from srcdir.  See note below.
  129.         elif [ -n "${next_srcdir}" ] ; then srcdir=`echo ${arg} | sed -e 's:/$::'` ; next_srcdir=
  130.         elif [ -n "${next_program_prefix}" ] ; then
  131.                 program_prefix=${arg}
  132.                 program_prefixoption="-program_prefix=${program_prefix}"
  133.                 next_program_prefix=
  134.         elif [ -n "${next_program_suffix}" ] ; then
  135.                 program_suffix=${arg}
  136.                 program_suffixoption="-program_suffix=${program_suffix}"
  137.                 next_program_suffix=
  138.         elif [ -n "${next_program_transform_name}" ] ; then
  139.                 # Double any backslashes or dollar signs in the argument
  140.         if [ -n "${arg}" ] ; then
  141.             program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  142.         fi
  143.                 program_transform_nameoption="${program_transform_nameoption} --program-transform-name='${arg}'"
  144.                 next_program_transform_name=
  145.         elif [ -n "${next_build}" ] ; then
  146.                 next_build=
  147.                 case "${build_alias}" in
  148.                 "")
  149.                         build_alias="${arg}"
  150.                         ;;
  151.                 *)
  152.                         echo '***' Can only configure for one build machine at a time.  1>&2
  153.                         fatal=yes
  154.                         ;;
  155.                 esac
  156.         elif [ -n "${next_target}" ] ; then
  157.                 next_target=
  158.                 case "${target_alias}" in
  159.                 "")
  160.                         target_alias="${arg}"
  161.                         ;;
  162.                 *)
  163.                         echo '***' Can only configure for one target at a time.  1>&2
  164.                         fatal=yes
  165.                         ;;
  166.                 esac
  167.         elif [ -n "${next_host}" ] ; then
  168.                 next_host=
  169.                 case "${host_alias}" in
  170.                 "")
  171.                         host_alias="${arg}"
  172.                         ;;
  173.                 *)
  174.                         echo '***' Can only configure for one host at a time.  1>&2
  175.                         fatal=yes
  176.                         ;;
  177.                 esac
  178.         elif [ -n "${next_tmpdir}" ] ; then
  179.                 next_tmpdir=
  180.                 tmpdiroption="--tmpdir=${arg}"
  181.                 TMPDIR=${arg}
  182.  
  183.         else
  184.                 case ${arg} in
  185.                 -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
  186.                         case "${build_alias}" in
  187.                         "") build_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
  188.                         *)
  189.                                 echo '***' Can only configure for one build machine at a time.  1>&2
  190.                                 fatal=yes
  191.                                 ;;
  192.                         esac
  193.                         ;;
  194.                 -build | --build | --buil | --bui | --bu | --b)
  195.                         next_build=yes
  196.                         ;;
  197.                 -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=* | -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* )
  198.                         exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
  199.                         exec_prefixoption=${arg}
  200.                         ;;
  201.                 -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e | -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec-)
  202.                         next_exec_prefix=yes
  203.                         ;;
  204.                 -gas | --g*)
  205.                         gas=yes
  206.                         ;;
  207.                 -help | --he*)
  208.                         fatal=true
  209.                         ;;
  210.                 -host=* | --host=* | --hos=* | --ho=*)
  211.                         case "${host_alias}" in
  212.                         "")
  213.                                 host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`"
  214.                                 ;;
  215.                         *)
  216.                                 echo '***' Can only configure for one host at a time.  1>&2
  217.                                 fatal=yes
  218.                                 ;;
  219.                         esac
  220.                         ;;
  221.                 -host | --host | --hos | --ho)
  222.                         case "${host_alias}" in
  223.                         "")
  224.                                 next_host=yes
  225.                                 ;;
  226.                         *)
  227.                                 echo '***' Can only configure for one host at a time.  1>&2
  228.                                 fatal=yes
  229.                                 ;;
  230.                         esac
  231.                         ;;
  232.                 -nfp | --nf*)
  233.                         floating_point=no
  234.                         ;;
  235.                 -norecursion | --no*)
  236.                         norecursion=true
  237.                         ;;
  238.                 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*)
  239.                         prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
  240.                         prefixoption=${arg}
  241.                         ;;
  242.                 -prefix | --prefix | --prefi | --pref | --pre)
  243.                         next_prefix=yes
  244.                         ;;
  245.                 -rm | --rm) removing=${arg} ;;
  246.                 -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | -program-prefix=* | --program-prefix=* | --program-prefi=* | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  247.                         program_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
  248.                         program_prefixoption=${arg}
  249.                         ;;
  250.                 -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | -program-prefix | --program-prefix | --program-prefi | --program-pref | --program-pre | --program-pr | --program-p)
  251.                         next_program_prefix=yes
  252.                         ;;
  253.                 -program_suffix=* | --program_suffix=* | --program_suffi=* | --program_suff=* | --program_suf=* | --program_su=* | --program_s=* | -program-suffix=* | --program-suffix=* | --program-suffi=* | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  254.                         program_suffix=`echo ${arg} | sed 's/^[-a-z_]*=//'`
  255.                         program_suffixoption=${arg}
  256.                         ;;
  257.                 -program_suffix | --program_suffix | --program_suffi | --program_suff | --program_suf | --program_su | --program_s |-program-suffix | --program-suffix | --program-suffi | --program-suff | --program-suf | --program-su | --program-s)
  258.                         next_program_suffix=yes
  259.                         ;;
  260.                 -program_transform_name=* | --program_transform_name=* | --program_transform_nam=* | --program_transform_na=* | --program_transform_n=* | --program_transform_=* | --program_transform=* | --program_transfor=* | --program_transfo=* | --program_transf=* | --program_trans=* | --program_tran=* | --program_tra=* | --program_tr=* | --program_t=* | -program-transform-name=* | --program-transform-name=* | --program-transform-nam=* | --program-transform-na=* | --program-transform-n=* | --program-transform-=* | --program-transform=* | --program-transfor=* | --program-transfo=* | --program-transf=* | --program-trans=* | --program-tran=* | --program-tra=* | --program-tr=* | --program-t=*)
  261.             arg=`echo ${arg} | sed -e 's/^[-a-z_]*=//'`
  262.                         # Double any \ or $ in the argument
  263.             if [ -n "${arg}" ] ; then
  264.                             program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  265.             fi
  266.                         program_transform_nameoption="${program_transform_nameoption} --program-transform-name='${arg}'"
  267.                         ;;
  268.                 -program_transform_name | --program_transform_name | --program_transform_nam | --program_transform_na | --program_transform_n | --program_transform_ | --program_transform | --program_transfor | --program_transfo | --program_transf | --program_trans | --program_tran | --program_tra | --program_tr | --program_t | -program-transform-name | --program-transform-name | --program-transform-nam | --program-transform-na | --program-transform-n | --program-transform- | --program-transform | --program-transfor | --program-transfo | --program-transf | --program-trans | --program-tran | --program-tra | --program-tr | --program-t)
  269.                         next_program_transform_name=yes
  270.                         ;;
  271.                 -site=* | --site=* | --sit=* | --si=*)
  272.                         site_option=${arg}
  273.                         site=`echo ${arg} | sed 's/^[-a-z]*=//'`
  274.                         ;;
  275.                 -site | --site | --sit)
  276.                         next_site=yes
  277.                         ;;
  278.                 # remove trailing slashes.  Otherwise, when the file name gets
  279.                 # bolted into an object file as debug info, it has two slashes in
  280.                 # it.  Ordinarily this is ok, but emacs takes double slash to
  281.                 # mean "forget the first part".
  282.                 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  283.                         srcdir=`echo ${arg} | sed 's/^[-a-z]*=//' | sed -e 's:/$::'`
  284.                         ;;
  285.                 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  286.                         next_srcdir=yes
  287.                         ;;
  288.                 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
  289.                         case "${target_alias}" in
  290.                         "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;;
  291.                         *)
  292.                                 echo '***' Can only configure for one target at a time.  1>&2
  293.                                 fatal=yes
  294.                                 ;;
  295.                         esac
  296.                         ;;
  297.                 -target | --target | --targe | --targ | --tar | --ta)
  298.                         next_target=yes
  299.                         ;;
  300.                 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
  301.                         tmpdiroption=${arg}
  302.                         TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
  303.                         ;;
  304.                 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
  305.                         next_tmpdir=yes
  306.                         ;;
  307.                 -v | -verbose | --v)
  308.                         redirect=
  309.                         verbose=-v
  310.                         ;;
  311.                 -version | -V | --version | --V)
  312.                         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  313.                         exit 0
  314.                         ;;
  315.                 -with*=* | --with*=*)
  316.                         withopt=`echo ${arg} | sed 's:^-*\(with[^=]*\)=.*$:\1:;s/-/_/g'`
  317.                         withval=`echo ${arg} | sed 's:^-*with[^=]*=\(.*\)$:\1:'`
  318.                         eval $withopt="$withval"
  319.                         withoptions="$withoptions $arg"
  320.                         ;;
  321.                 -without* | --without*)
  322.                         withopt=`echo ${arg} | sed 's:^-*without:with:;s/-/_/g'`        
  323.                         eval $withopt=no
  324.                         withoutoptions="$withoutoptions $arg"
  325.                         ;;
  326.                 -with* | --with*)
  327.                         withopt=`echo ${arg} | sed 's:^-*with:with:;s/-/_/g'`
  328.                         eval $withopt=yes
  329.                         withoptions="$withoptions $arg"
  330.                         ;;
  331.                 -x | --x) ;;
  332.                 -* | --*)
  333.                         (echo ;
  334.                         echo "Unrecognized option: \"${arg}\"". ;
  335.                         echo) 1>&2
  336.                         fatal=true
  337.                         ;;
  338.                 *)
  339.                         case "${undefs}" in
  340.                         "")
  341.                                 undefs="${arg}"
  342.                                 ;;
  343.                         *)
  344.                                 echo '***' Can only configure for one host and one target at a time.  1>&2
  345.                                 fatal=yes
  346.                                 ;;
  347.                         esac
  348.                         ;;
  349.                 esac
  350.         fi
  351. done
  352.  
  353. # process host and target
  354. case "${fatal}" in
  355. "")
  356. #       # Complain if an arg is missing
  357. #       if [ -z "${host_alias}" ] ; then
  358. #               (echo ;
  359. #               echo "configure: No HOST specified." ;
  360. #               echo) 1>&2
  361. #               fatal=true
  362. #       fi
  363.  
  364. ### This is a bit twisted.
  365. ### * if all three are specified, this is an error.
  366. ### * if we have neither hosts, nor unadorned args, guess with config.guess.
  367. ### * if no hosts are specified, then the unadorned args are hosts, but if
  368. ### there were none, this is an error.
  369. ### * if no targets are specified, then the unadorned args are targets, but if
  370. ### there were no unadorned args, then the hosts are also targets.
  371.  
  372.         if [ -n "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ]
  373.     then
  374.                 echo '***' Can only configure for one host and one target at a time.  1>&2
  375.                 fatal=yes
  376.         elif [ -z "${host_alias}" -a -z "${target_alias}" -a -z "${undefs}" ]
  377.     then
  378.                 guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  379.                 if tmp_alias=`${guesssys}` ; then
  380.                         echo "Configuring for a ${tmp_alias} host." 1>&2
  381.                         host_alias=${tmp_alias}
  382.             case "${target_alias}" in
  383.             "") target_alias=${tmp_alias} ;;
  384.             *) ;;
  385.             esac
  386.             arguments="--host=${host_alias} ${arguments}"
  387.                 else
  388.                         echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  389.                         fatal=yes
  390.                 fi
  391.         else
  392.                 case "${host_alias}" in
  393.                 "")
  394.                         case "${undefs}" in
  395.                         "")     host_alias=${target_alias} ;;
  396.                         *)      host_alias=${undefs} ;;
  397.                         esac
  398.                         ;;
  399.                 *) ;;
  400.                 esac
  401.  
  402.                 case "${target_alias}" in
  403.                 "")
  404.                         case "${undefs}" in
  405.                         "")     target_alias=${host_alias} ;;
  406.                         *)      target_alias=${undefs} ;;
  407.                         esac
  408.                         ;;
  409.                 *) ;;
  410.                 esac
  411.         fi
  412.         ;;
  413. *) ;;
  414. esac
  415.  
  416. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  417.         (echo "Usage: configure HOST" ;
  418.         echo ;
  419.         echo "Options: [defaults in brackets]" ;
  420.         echo " --prefix=MYDIR            configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
  421.         echo " --exec-prefix=MYDIR       configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
  422.         echo " --help                    print this message. [normal config]" ;
  423.         echo " --build=BUILD             configure for building on BUILD.  [BUILD=HOST]" ;
  424.         echo " --host=HOST               configure for HOST.  [determined via config.guess]" ;
  425.         echo " --norecursion             configure this directory only. [recurse]" ;
  426.         echo " --program-prefix=FOO      install programs with FOO prepended to their names. [ \"\" ]" ;
  427.         echo " --program-suffix=FOO      install programs with FOO appended to their names. [ \"\" ]" ;
  428.         echo " --program-transform-name=FOO      install programs with names transformed by sed pattern FOO. [ \"\" ]" ;
  429.         echo " --site=SITE               configure with site specific makefile for SITE" ;
  430.         echo " --srcdir=DIR              find the sources in DIR. [\".\" or \"..\"]" ;
  431.         echo " --target=TARGET           configure for TARGET.  [TARGET = HOST]" ;
  432.         echo " --tmpdir=TMPDIR           create temporary files in TMPDIR.  [ TMPDIR = \"/tmp\" ]" ;
  433.         echo " --nfp                     configure the compilers default to soft floating point. [hard float]" ;
  434.         echo " --with-FOO, --with-FOO=BAR specify that FOO is available"
  435.         echo " --without-FOO             specify that FOO is NOT available"
  436.         echo ;
  437.         echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
  438.         echo ;
  439.         ) 1>&2
  440.         if [ -r config.status ] ; then
  441.                 cat config.status
  442.         fi
  443.  
  444.         exit 1
  445. fi
  446.  
  447. configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  448. moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  449.  
  450. # this is a hack.  sun4 must always be a valid host alias or this will fail.
  451. if ${configsub} sun4 >/dev/null 2>&1 ; then
  452.         true
  453. else
  454.         echo '***' cannot find config.sub.  1>&2
  455.         exit 1
  456. fi
  457.  
  458. touch config.junk
  459. if ${moveifchange} config.junk config.trash ; then
  460.         true
  461. else
  462.         echo '***' cannot find move-if-change.  1>&2
  463.         exit 1
  464. fi
  465. rm -f config.junk config.trash
  466.  
  467. case "${srcdir}" in
  468. "")
  469.         if [ -r configure.in ] ; then
  470.                 srcdir=.
  471.         else
  472.                 if [ -r ${progname}.in ] ; then
  473.                         srcdir=`echo ${progname} | sed 's:/configure$::'`
  474.                 else
  475.                         echo '***' "Can't find configure.in.  Try using -srcdir=some_dir"  1>&2
  476.                         exit 1
  477.                 fi
  478.         fi
  479.         ;;
  480. *) ;;
  481. esac
  482.  
  483. ### warn about some conflicting configurations.
  484.  
  485. case "${srcdir}" in
  486. ".") ;;
  487. *)
  488.         if [ -f ${srcdir}/config.status ] ; then
  489.                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  490.                 exit 1
  491.         fi
  492. esac
  493.  
  494. # default exec_prefix
  495. case "${exec_prefix}" in
  496. "") exec_prefix="\$(prefix)" ;;
  497. *) ;;
  498. esac
  499.  
  500. ### break up ${srcdir}/configure.in.
  501. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  502. "")
  503.         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  504.         exit 1
  505.         ;;
  506. *) ;;
  507. esac
  508.  
  509. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  510. "")
  511.         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  512.         exit 1
  513.         ;;
  514. *) ;;
  515. esac
  516.  
  517. case "${TMPDIR}" in
  518. "") TMPDIR=/tmp ; export TMPDIR ;;
  519. *) ;;
  520. esac
  521.  
  522. # keep this filename short for &%*%$*# 14 char file names
  523. tmpfile=${TMPDIR}/cONf$$
  524. trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
  525.  
  526. # split ${srcdir}/configure.in into common, per-host, per-target,
  527. # and post-target parts.  Post-target is optional.
  528. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  529. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  530. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  531.   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  532.   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  533. else
  534.   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  535.   echo >${tmpfile}.pos
  536. fi
  537.  
  538. ### do common part of configure.in
  539.  
  540. . ${tmpfile}.com
  541.  
  542. # some sanity checks on configure.in
  543. case "${srctrigger}" in
  544. "")
  545.         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
  546.         exit 1
  547.         ;;
  548. *) ;;
  549. esac
  550.  
  551. case "${build_alias}" in
  552. "")    ;;
  553. *)
  554.     result=`${configsub} ${build_alias}`
  555.         buildopt="--build=${build_alias}"
  556.     build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  557.     build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  558.     build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  559.     build=${build_cpu}-${build_vendor}-${build_os}
  560.     ;;
  561. esac
  562.  
  563. result=`${configsub} ${host_alias}`
  564. host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  565. host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  566. host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  567. host=${host_cpu}-${host_vendor}-${host_os}
  568.  
  569. . ${tmpfile}.hst
  570.  
  571. result=`${configsub} ${target_alias}`
  572. target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  573. target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  574. target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  575. target=${target_cpu}-${target_vendor}-${target_os}
  576.  
  577. . ${tmpfile}.tgt
  578.  
  579. # Find the source files, if location was not specified.
  580. case "${srcdir}" in
  581. "")
  582.         srcdirdefaulted=1
  583.         srcdir=.
  584.         if [ ! -r ${srctrigger} ] ; then
  585.                 srcdir=..
  586.         fi
  587.         ;;
  588. *) ;;
  589. esac
  590.  
  591. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  592.         case "${srcdirdefaulted}" in
  593.         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  594.         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  595.         esac
  596.  
  597.         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  598.         exit 1
  599. fi
  600.  
  601. # Some systems (e.g., one of the i386-aix systems the gas testers are
  602. # using) don't handle "\$" correctly, so don't use it here.
  603. tooldir='$(exec_prefix)'/${target_alias}
  604.  
  605. if [ "${host_alias}" != "${target_alias}" ] ; then
  606.     if [ "${program_prefixoption}" = "" ] ; then
  607.         if [ "${program_suffixoption}" = "" ] ; then 
  608.             if [ "${program_transform_nameoption}" = "" ] ; then
  609.                 program_prefix=${target_alias}- ;
  610.             fi
  611.         fi
  612.     fi
  613. fi
  614.  
  615. # Merge program_prefix and program_suffix onto program_transform_name
  616. # Use a double $ so that make ignores it
  617. if [ "${program_suffix}" != "" ] ; then
  618.     program_transform_name="-e s/\$\$/${program_suffix}/ ${program_transform_name}"
  619. fi
  620.  
  621. if [ "${program_prefix}" != "" ] ; then
  622.     program_transform_name="-e s/^/${program_prefix}/ ${program_transform_name}"
  623. fi
  624.  
  625. for subdir in . ${subdirs} ; do
  626.  
  627.     # ${subdir} is relative path from . to the directory we're currently
  628.     # configuring.
  629.     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  630.     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  631.  
  632.     ### figure out what to do with srcdir
  633.     case "${srcdir}" in
  634.         ".")  # no -srcdir option.  We're building in place.
  635.                 makesrcdir=. ;;
  636.         /*) # absolute path
  637.                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  638.                 ;;
  639.         *) # otherwise relative
  640.                 case "${subdir}" in
  641.                 .) makesrcdir=${srcdir} ;;
  642.                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  643.                 esac
  644.                 ;;
  645.     esac
  646.  
  647.     if [ "${subdir}/" != "./" ] ; then
  648.         Makefile=${subdir}/Makefile
  649.     fi
  650.  
  651.     if [ ! -d ${subdir} ] ; then
  652.         if mkdir ${subdir} ; then
  653.                 true
  654.         else
  655.                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  656.                 exit 1
  657.         fi
  658.     fi
  659.  
  660.     case "${removing}" in
  661.     "")
  662.         case "${subdir}" in
  663.         .) ;;
  664.         *) eval echo Building in ${subdir} ${redirect} ;;
  665.         esac
  666.  
  667.         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  668.         # Set up the list of links to be made.
  669.         # ${links} is the list of link names, and ${files} is the list of names to link to.
  670.  
  671.         # Make the links.
  672.         configlinks="${links}"
  673.         if [ -r ${subdir}/config.status ] ; then
  674.                 mv -f ${subdir}/config.status ${subdir}/config.back
  675.         fi
  676.         while [ -n "${files}" ] ; do
  677.                 # set file to car of files, files to cdr of files
  678.                 set ${files}; file=$1; shift; files=$*
  679.                 set ${links}; link=$1; shift; links=$*
  680.  
  681.                 if [ ! -r ${srcdir}/${file} ] ; then
  682.                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  683.                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  684.                         exit 1
  685.                 fi
  686.  
  687.                 ${remove} -f ${link}
  688.                 # Make a symlink if possible, otherwise try a hard link
  689.                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
  690.  
  691.                 if [ ! -r ${link} ] ; then
  692.                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  693.                         exit 1
  694.                 fi
  695.  
  696.                 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  697.         done
  698.  
  699.         # Create a .gdbinit file which runs the one in srcdir
  700.         # and tells GDB to look there for source files.
  701.  
  702.         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  703.                 case ${srcdir} in
  704.                 .) ;;
  705.                 *) cat > ${subdir}/.gdbinit <<EOF
  706. # ${NO_EDIT}
  707. dir .
  708. dir ${makesrcdir}
  709. source ${makesrcdir}/.gdbinit
  710. EOF
  711.                         ;;
  712.                 esac
  713.         fi
  714.  
  715.         # Install a makefile, and make it set VPATH
  716.         # if necessary so that the sources are found.
  717.         # Also change its value of srcdir.
  718.         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
  719.         # been somewhat optimized and is perhaps a bit twisty.
  720.  
  721.         # code is order so as to try to sed the smallest input files we know.
  722.  
  723.         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
  724.         # package, target, host, and site.  so do these separately because I don't trust the
  725.         #  order of sed -e expressions.
  726.  
  727.         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  728.  
  729.             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
  730.             rm -f ${subdir}/Makefile.tem
  731.               case "${site}" in
  732.               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  733.               *)
  734.                       site_makefile_frag=${srcdir}/config/ms-${site}
  735.  
  736.                       if [ -f ${site_makefile_frag} ] ; then
  737.                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
  738.                                       > ${subdir}/Makefile.tem
  739.                       else
  740.                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  741.                               site_makefile_frag=
  742.                       fi
  743.                       ;;
  744.             esac
  745.             # working copy now in ${subdir}/Makefile.tem
  746.  
  747.             # Conditionalize the makefile for this host.
  748.             rm -f ${Makefile}
  749.             case "${host_makefile_frag}" in
  750.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  751.               *)
  752.                       if [ ! -f ${host_makefile_frag} ] ; then
  753.                               host_makefile_frag=${srcdir}/${host_makefile_frag}
  754.                       fi
  755.                       if [ -f ${host_makefile_frag} ] ; then
  756.                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  757.                       else
  758.                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  759.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  760.                               mv ${subdir}/Makefile.tem ${Makefile}
  761.                       fi
  762.             esac
  763.             # working copy now in ${Makefile}
  764.  
  765.             # Conditionalize the makefile for this target.
  766.             rm -f ${subdir}/Makefile.tem
  767.             case "${target_makefile_frag}" in
  768.               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  769.               *)
  770.                       if [ ! -f ${target_makefile_frag} ] ; then
  771.                               target_makefile_frag=${srcdir}/${target_makefile_frag}
  772.                       fi
  773.                       if [ -f ${target_makefile_frag} ] ; then
  774.                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  775.                       else
  776.                               mv ${Makefile} ${subdir}/Makefile.tem
  777.                               target_makefile_frag=
  778.                       fi
  779.                       ;;
  780.             esac
  781.             # real copy now in ${subdir}/Makefile.tem
  782.  
  783.             # Conditionalize the makefile for this package.
  784.             rm -f ${Makefile}
  785.             case "${package_makefile_frag}" in
  786.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  787.               *)
  788.                       if [ ! -f ${package_makefile_frag} ] ; then
  789.                               package_makefile_frag=${srcdir}/${package_makefile_frag}
  790.                       fi
  791.                       if [ -f ${package_makefile_frag} ] ; then
  792.                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  793.                       else
  794.                               echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
  795.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  796.                               mv ${subdir}/Makefile.tem ${Makefile}
  797.                       fi
  798.             esac
  799.             # working copy now in ${Makefile}
  800.  
  801.             mv ${Makefile} ${subdir}/Makefile.tem
  802.  
  803.             # real copy now in ${subdir}/Makefile.tem
  804.  
  805.             # prepend warning about editting, and a bunch of variables.
  806.             rm -f ${Makefile}
  807.             cat > ${Makefile} <<EOF
  808. # ${NO_EDIT}
  809. VPATH = ${makesrcdir}
  810. links = ${configlinks}
  811. host_alias = ${host_alias}
  812. host_cpu = ${host_cpu}
  813. host_vendor = ${host_vendor}
  814. host_os = ${host_os}
  815. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  816. target_alias = ${target_alias}
  817. target_cpu = ${target_cpu}
  818. target_vendor = ${target_vendor}
  819. target_os = ${target_os}
  820. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  821. EOF
  822.         case "${build}" in
  823.           "") ;;
  824.           *)  cat >> ${Makefile} << EOF
  825. build_alias = ${build_alias}
  826. build_cpu = ${build_cpu}
  827. build_vendor = ${build_vendor}
  828. build_os = ${build_os}
  829. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  830. EOF
  831.         esac
  832.  
  833.             case "${package_makefile_frag}" in
  834.               "") ;;
  835.               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  836.               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  837.             esac
  838.  
  839.             case "${target_makefile_frag}" in
  840.               "") ;;
  841.               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  842.               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  843.             esac
  844.  
  845.             case "${host_makefile_frag}" in
  846.               "") ;;
  847.               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  848.               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  849.             esac
  850.  
  851.             if [ "${site_makefile_frag}" != "" ] ; then
  852.                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  853.             fi 
  854.  
  855.         # make sure that some sort of reasonable default exists for these 
  856.         # two variables
  857.         CXX=${CXX-"g++ -O"}
  858.         CC=${CC-cc}
  859.  
  860.             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  861.             # remove any form feeds.
  862.             if [ -z "${subdirs}" ]; then
  863.                 rm -f ${subdir}/Makefile.tem2
  864.                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
  865.                     -e "s:^NONSUBDIRS[     ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  866.                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
  867.                 rm -f ${subdir}/Makefile.tem
  868.                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
  869.             fi
  870.             sed -e "s:^prefix[     ]*=.*$:prefix = ${prefix}:" \
  871.                     -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
  872.             -e "s:^SHELL[     ]*=.*$:SHELL = ${config_shell}:" \
  873.                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
  874.                     -e "s/ //" \
  875.                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
  876.                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
  877.                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
  878.                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
  879.                     ${subdir}/Makefile.tem >> ${Makefile}
  880.             # final copy now in ${Makefile}
  881.  
  882.         else
  883.            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  884.         fi
  885.  
  886.         rm -f ${subdir}/Makefile.tem
  887.  
  888.         case "${host_makefile_frag}" in
  889.         "") using= ;;
  890.         *) using="and \"${host_makefile_frag}\"" ;;
  891.         esac
  892.  
  893.         case "${target_makefile_frag}" in
  894.         "") ;;
  895.         *) using="${using} and \"${target_makefile_frag}\"" ;;
  896.         esac
  897.  
  898.         case "${site_makefile_frag}" in
  899.         "") ;;
  900.         *) using="${using} and \"${site_makefile_frag}\"" ;;
  901.         esac
  902.  
  903.         newusing=`echo "${using}" | sed 's/and/using/'`
  904.         using=${newusing}
  905.         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  906.  
  907.         . ${tmpfile}.pos
  908.  
  909.         # describe the chosen configuration in config.status.
  910.         # Make that file a shellscript which will reestablish
  911.         # the same configuration.  Used in Makefiles to rebuild
  912.         # Makefiles.
  913.  
  914.         case "${norecursion}" in
  915.         "") arguments="${arguments} -norecursion" ;;
  916.         *) ;;
  917.         esac
  918.  
  919.         if [ ${subdir} = . ] ; then
  920.             echo "#!/bin/sh
  921. # ${NO_EDIT}
  922. # This directory was configured as follows:
  923. ${progname}" ${arguments}  "
  924. # ${using}" > ${subdir}/config.new
  925.         else
  926.             echo "#!/bin/sh
  927. # ${NO_EDIT}
  928. # This directory was configured as follows:
  929. cd ${invsubdir}
  930. ${progname}" ${arguments}  "
  931. # ${using}" > ${subdir}/config.new
  932.         fi
  933.         chmod a+x ${subdir}/config.new
  934.         if [ -r ${subdir}/config.back ] ; then
  935.                 mv -f ${subdir}/config.back ${subdir}/config.status
  936.         fi
  937.         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  938.         ;;
  939.  
  940.     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  941.     esac
  942. done
  943.  
  944. # If there are subdirectories, then recur. 
  945. if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
  946.         for configdir in ${configdirs} ; do
  947.  
  948.                 if [ -d ${srcdir}/${configdir} ] ; then
  949.                         eval echo Configuring ${configdir}... ${redirect}
  950.                         case "${srcdir}" in
  951.                         ".") ;;
  952.                         *)
  953.                                 if [ ! -d ./${configdir} ] ; then
  954.                                         if mkdir ./${configdir} ; then
  955.                                                 true
  956.                                         else
  957.                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
  958.                                                 exit 1
  959.                                         fi
  960.                                 fi
  961.                                 ;;
  962.                         esac
  963.  
  964.                         POPDIR=${PWD=`pwd`}
  965.                         cd ${configdir} 
  966.  
  967. ### figure out what to do with srcdir
  968.                         case "${srcdir}" in
  969.                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
  970.                         /*) # absolute path
  971.                                 newsrcdir=${srcdir}/${configdir}
  972.                                 srcdiroption="-srcdir=${newsrcdir}"
  973.                                 ;;
  974.                         *) # otherwise relative
  975.                                 newsrcdir=../${srcdir}/${configdir}
  976.                                 srcdiroption="-srcdir=${newsrcdir}"
  977.                                 ;;
  978.                         esac
  979.  
  980. ### check for guested configure, otherwise fix possibly relative progname
  981.                         if [ -f ${newsrcdir}/configure ] ; then
  982.                                 recprog=${newsrcdir}/configure
  983.                         elif [ -f ${newsrcdir}/configure.in ] ; then
  984.                                 case "${progname}" in
  985.                                 /*)     recprog=${progname} ;;
  986.                                 *)      recprog=../${progname} ;;
  987.                                 esac
  988.             else
  989.                 eval echo No configuration information in ${configdir} ${redirect}
  990.                 recprog=
  991.                         fi
  992.  
  993. ### The recursion line is here.
  994.             if [ ! -z "${recprog}" ] ; then
  995.                             if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  996.                                     ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  997.                                     ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${removing} ${redirect} ; then
  998.                                     true
  999.                             else
  1000.                                     exit 1
  1001.                             fi
  1002.             fi
  1003.  
  1004.                         cd ${POPDIR}
  1005.                 fi
  1006.         done
  1007. fi
  1008.  
  1009. exit 0
  1010.  
  1011. #
  1012. # Local Variables:
  1013. # fill-column: 131
  1014. # End:
  1015. #
  1016.  
  1017. # end of configure
  1018.